﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="AddOffer.aspx.cs" Inherits="AddOffer" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Welcome to Car Offers in ASP.NET!
    </h2>
    <p>
        <asp:HyperLink ID="offersPageLink" NavigateUrl="~/Default.aspx" Text="Go to Offers" runat="server" />
    </p>
    <p>
        <asp:Panel ID="notificationMsgPanel" CssClass="failureNotification" Visible="false" runat="server">
            <asp:BulletedList ID="notificationMsgList" runat="server">
            </asp:BulletedList>
        </asp:Panel>
        <asp:ValidationSummary ID="CarOfferValidationSummary" runat="server" CssClass="failureNotification" 
            ValidationGroup="CarOfferValidationGroup"/>    
    </p>
    <p>
	    <div class="filterInfo">
	    <fieldset class="register">			
		    <legend>Offer information</legend>				
		    <p>
                <span>Brand</span>
			    <asp:DropDownList ID="brandsDropDown" runat="server" DataValueField="Id" DataTextField="Name" OnSelectedIndexChanged="Brands_IndexChanged" AutoPostBack="true" >
                </asp:DropDownList>
                <asp:CustomValidator ID="BrandsValidator" runat="server" ControlToValidate="brandsDropDown" CssClass="failureNotification"
                    ErrorMessage="Please select valid brand." ToolTip="Please select valid brand." ValidationGroup="CarOfferValidationGroup"
                    OnServerValidate="Brand_ServerValidate">X</asp:CustomValidator>
                <span>Model</span>
                <asp:DropDownList ID="modelsDropDown" runat="server" DataValueField="Id" DataTextField="Name" >
                    <asp:ListItem Value="-1">-- Select model --</asp:ListItem>
                </asp:DropDownList>
                <asp:CustomValidator ID="modelsValidator" runat="server" ControlToValidate="modelsDropDown" CssClass="failureNotification"
                    ErrorMessage="Please select valid model." ToolTip="Please select valid model." ValidationGroup="CarOfferValidationGroup"
                    OnServerValidate="Model_ServerValidate">X</asp:CustomValidator>
		    </p>
		    <p>
                <span>Make year</span>
                <asp:TextBox ID="makeYear" runat="server" />
                <asp:RequiredFieldValidator ID="makeYearRequired" runat="server" ControlToValidate="makeYear" 
                        CssClass="failureNotification" ErrorMessage="Year is required." ToolTip="Year is required." 
                        ValidationGroup="CarOfferValidationGroup">*</asp:RequiredFieldValidator>
                <asp:CustomValidator ID="yearValidator" runat="server" ControlToValidate="makeYear" CssClass="failureNotification"
                    ErrorMessage="Year is not valid number." ToolTip="Year is not valid number." ValidationGroup="CarOfferValidationGroup"
                    OnServerValidate="MakeYear_ServerValidate">X</asp:CustomValidator>
		    </p>
		    <p>
			    <span>Price &#36;</span>
                <asp:TextBox ID="priceTxt" runat="server" />
                <asp:RequiredFieldValidator ID="priceRequired" runat="server" ControlToValidate="priceTxt" 
                    CssClass="failureNotification" ErrorMessage="Price value is required." ToolTip="Price value is required." 
                    ValidationGroup="CarOfferValidationGroup">*</asp:RequiredFieldValidator>    
                <asp:CustomValidator ID="priceValidator" runat="server" ControlToValidate="priceTxt" CssClass="failureNotification"
                    ErrorMessage="Price is not valid number." ToolTip="Price is not valid number." ValidationGroup="CarOfferValidationGroup"
                    OnServerValidate="Price_ServerValidate">X</asp:CustomValidator>
		    </p>
		    <p>
			    <span>Currency</span>
			    <asp:DropDownList ID="currencies" runat="server" OnSelectedIndexChanged="Currencies_IndexChanged" AutoPostBack="true" >
                </asp:DropDownList>
                <asp:Label ID="currencyInfo" runat="server" />
		    </p>
		    <p>
			    <span>Contact</span>
                <asp:TextBox ID="contact" runat="server" />
                <asp:RequiredFieldValidator ID="contactRequired" runat="server" ControlToValidate="contact" 
                    CssClass="failureNotification" ErrorMessage="Contact is required." ToolTip="Contact is required." 
                    ValidationGroup="CarOfferValidationGroup">*</asp:RequiredFieldValidator>
                <asp:CustomValidator ID="contactValidator1" runat="server" ControlToValidate="contact" CssClass="failureNotification" ValidationGroup="CarOfferValidationGroup"
                    OnServerValidate="Contact_ServerValidate">X</asp:CustomValidator>
                <%-- <asp:CustomValidator ID="contactValidator" runat="server" ControlToValidate="contact" CssClass="failureNotification"
                    ErrorMessage="Contact is not in valid format." ToolTip="Contact is not in valid format." ValidationGroup="CarOfferValidationGroup"
                    OnServerValidate="Contact_ServerValidate">X</asp:CustomValidator>--%>
		    </p>
	    </fieldset>
	    <p class="submitButton">
            <asp:Button ID="cancelBtn" Text="Cancel" runat="server" OnClick="Cancel_OnClick" />
            <asp:Button ID="saveBtn" Text="Save" runat="server" OnClick="SaveOffer_OnClick"
                ValidationGroup="CarOfferValidationGroup" />
	    </p>
	    </div>							    
    </p>
</asp:Content>
